package com.shanzmoo.admin.manager.store;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import ${package.Entity}.query.${entity? replace('Entity','Query')};
import ${package.Entity}.vo.${entity? replace('Entity','VO')};
import com.shanzmoo.base.bean.PageRespBase;
import ${package.Service}.${table.serviceName};
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * ${table.comment!} 管理器
 *
 * @author ${author} ${date}
 */
@Slf4j
@Component
public class ${table.controllerName? replace('Controller','Manager')} {

    @Autowired
    private ${table.serviceName} ${(entity? replace('Entity','Service'))?uncap_first};

    /**
     * 分页查询
     */
    public PageRespBase<${entity? replace('Entity','VO')}> queryPage(${entity? replace('Entity','Query')} query) {
        Page page = PageHelper.startPage(query.getPageNum(), query.getPageSize());
        List<${entity? replace('Entity','VO')}> reList = ${(entity? replace('Entity','Service'))?uncap_first}.queryPageList(query);

        PageRespBase<${entity? replace('Entity','VO')}> result = PageRespBase.create(page, reList);
        PageHelper.clearPage();
        return result;
    }
 }
